//
// Source code recreated from a .class file by IntelliJ IDEA
// (powered by FernFlower decompiler)
//

package test.求子集;

import java.util.ArrayList;
import java.util.List;

public class demo {
    public demo() {
    }

    public static void main(String[] args) {
        int[] nums = new int[]{1, 2, 3};

        for(List<Integer> list : demo1(nums)) {
            System.out.println(list);
        }

    }

    public static List<List<Integer>> demo1(int[] nums) {
        List<List<Integer>> result = new ArrayList();
        int n = nums.length;

        for(int i = 1; i < 1 << n; ++i) {
            List<Integer> subset = new ArrayList();

            for(int j = 0; j < n; ++j) {
                if ((i & 1 << j) != 0) {
                    subset.add(nums[j]);
                }
            }

            result.add(subset);
        }

        return result;
    }
}
